/*
MyCart
*/
//var Dtimeout;
//var Dspeed;
var Dtimer=null;
var Dtimer2=null;
var Mdisplay=false;
var hideDiv;
var Container;
var button;
var jqShowObj;
var offset;
var height;
var width;
var btnHeight;
var btnWidth;
function initDMenu(obj,showobj,Dtimeout,Dspeed){
	hideDiv=document.createElement("div");
	hideDiv.setAttribute("style", "z-index:10000");
	Container=document.createElement("div");
	Container.setAttribute("id", "Container");
	hideDiv.appendChild(Container);
	document.body.appendChild(hideDiv);
	button = document.getElementById(obj);
	//alert(button);
	jqShowObj=document.getElementById(showobj);
	offsetLeft=button.offsetLeft;
	offsetTop=button.offsetTop;
	height=jqShowObj.offsetHeight;
	width=jqShowObj.offsetWidth;
	btnHeight=button.offsetHeight;
	btnWidth=button.offsetWidth;
	document.body.appendChild(hideDiv);
}
function showDMenu(){
	if (Mdisplay==true){
		return false;
	}else{
		Mdisplay=true;
		Container.setAttribute("style", "margin:auto; width:"+btnWidth+"px; height:"+btnHeight+"px;border:1px solid #666666");
		hideDiv.setAttribute("style", "position:absolute; top:"+(offsetTop+16)+"px; left:"+(offsetLeft-35)+"px;; height:"+height+"px;width:"+width+"px");
		hideDiv.style.display = 'block';
		//Container.css({margin:"0 auto",width:btnWidth+"px",height:btnHeight+"px"});
		//hideDiv.css({position:"absolute",top:offset.top+16+"px",left:button.offset().left-35+"px",height:height+"px",width:width+"px"}).show();
		//Container.css({border:"1px solid #666666"});
		Container.setAttribute("style", "marginTop:10; height:"+(height+4)+"px; width:"+(width+4)+"px;opacity:'100'");
		jqShowObj.style.display = 'block';
		Container.appendChild(jqShowObj);
		Container.setAttribute("style", "border:0px");
		jqShowObj.setAttribute("style", "onmousemove:cssmouseover();");
		jqShowObj.setAttribute("style", "onmouseout:cssonmouseout();");
	}
}

function cssmouseover()
{
	clearTimeout(Dtimer);clearTimeout(Dtimer2);
}

function cssonmouseout()
{
	hideDMenu();
}

function hideDMenu(){
	clearTimeout(Dtimer);
	clearTimeout(Dtimer2);
	Dtimer=setTimeout(function(){
		//alert(Container);
		Container.setAttribute("style", "border:1px solid #666666");
		document.body.appendChild(jqShowObj);
		jqShowObj.style.display = 'none';
		Container.removeChild(jqShowObj);
		Container.setAttribute("style", "width:"+btnWidth+";height:"+btnHeight+";marginTop:0;opacity:0;");
			Container.style.display = 'none';
			hideDiv.style.display = 'none';
			Mdisplay=false;
		}, 100); 
}

function cartMouseOver()
{
	clearTimeout(Dtimer);
	height=document.getElementById("MyCart").offsetHeight;
	Dtimer=setTimeout("showDMenu()",100); 
}

function cartMouseOut()
{
	clearTimeout(Dtimer); 
	if(Mdisplay==true){
		Dtimer2=setTimeout("hideDMenu()",100);
	}
}
/*-----------------------------*/
window.onload = function(){
initDMenu("CartSwitch_wrap","MyCart");
};